Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: QuickTime

Previous | Overview | Contents | Next |

Low-Level Movie-Editing Functions

The Movie Toolbox provides a number of functions that allow your application to perform low-level editing operations on movies. These functions work with movie segments--pieces of a movie that are defined by a starting time and duration--and therefore give you a great deal of control over the editing process. These functions never copy the movie data; rather, they work with references to the movie's data. "Editing Movies," which begins on Editing Movies , discusses the Movie Toolbox functions that allow you to edit movies by working with the current selection.

You can use the CopyMovieSettings function to copy certain important settings from one movie to another.

You can use the InsertMovieSegment function to copy a segment from one movie to another. Use the InsertMovieEmptySegment function to insert an empty segment into a movie.

Your application can delete a segment from a movie by calling the DeleteMovieSegment function.

You can change a segment's duration by calling the ScaleMovieSegment function. This function stretches or shrinks the segment to accommodate a specified duration.

InsertMovieSegment

The InsertMovieSegment function copies part of one movie to another. You specify the starting time and duration of the source segment and the time in the destination movie at which to place the information.

pascal OSErr InsertMovieSegment (Movie srcMovie, Movie dstMovie,
                                         TimeValue srcIn,
                                         TimeValue srcDuration,
                                         TimeValue dstIn);
srcMovie
Specifies the source movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively). The InsertMovieSegment function obtains the movie segment from the source movie specified in this parameter.

dstMovie
Specifies the destination movie for this operation. The InsertMovieSegment function places a copy of the segment, which is obtained from the source movie, into this destination movie. The dstIn parameter specifies where the segment is inserted.

srcIn
Specifies the start of the segment in the source movie. The srcDuration parameter specifies the segment's duration. This time value must be expressed in the source movie's time scale.

srcDuration
Specifies the duration of the segment in the source movie. This time value must be expressed in the source movie's time scale.

dstIn
Contains a time value specifying where the segment is to be inserted. This time value must be expressed in the destination movie's time scale.

DESCRIPTION

The InsertMovieSegment function does not change the source movie. However, the duration of the destination movie is extended to accommodate the inserted segment. You can use this function to add a segment beyond the end of the destination movie--the Movie Toolbox inserts empty space as appropriate.

You can use the InsertMovieSegment function to copy data within a single movie. If you are not copying data from one location in a movie to a different point in the same movie, the function may create new tracks, as appropriate.

Whenever possible, the Movie Toolbox uses existing tracks to store the data to be inserted. Before adding a track to the destination movie, the toolbox looks in the destination movie for tracks that have the same characteristics as the tracks in the source movie. The toolbox considers the following characteristics when searching for an appropriate track:

If the Movie Toolbox cannot find an appropriate track in the destination movie, it creates a track with the proper characteristics.

If you have assigned a progress function to the destination movie, the Movie Toolbox calls that progress function during long copy operations. For details on application-defined progress functions, see "Progress Functions," .

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

invalidDuration

-2014

This duration value is invalid

invalidTime

-2015

This time value is invalid

progressProcAborted

-2019

Your progress function returned an error

Memory Manager errors

InsertEmptyMovieSegment

The InsertEmptyMovieSegment function adds an empty segment to a movie. You specify the starting time and duration of the empty segment to be added. These times must be expressed in the movie's time scale.

pascal OSErr InsertEmptyMovieSegment (Movie dstMovie,
                                         TimeValue dstIn,
                                         TimeValue dstDuration);
dstMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

dstIn
Contains a time value specifying where the segment is to be inserted. This time value must be expressed in the movie's time scale.

dstDuration
Contains a time value that specifies the duration of the segment to be added.

DESCRIPTION

The InsertEmptyMovieSegment function then inserts the appropriate amount of empty time into each of the movie's tracks. The exact meaning of the term empty time depends upon the type of track. For example, empty time in a sound track is silent.

You cannot add empty space to the end of a movie. If you want to insert a segment beyond the end of a movie, use the InsertMovieSegment function, which is described in the previous section.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

invalidDuration

-2014

This duration value is invalid

invalidTime

-2015

This time value is invalid

Memory Manager errors

DeleteMovieSegment

The DeleteMovieSegment function removes a specified segment from a movie. You identify the segment to remove by specifying its starting time and duration.

pascal OSErr DeleteMovieSegment (Movie theMovie,
                                         TimeValue startTime,
                                         TimeValue duration);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

startTime
Contains a time value specifying the starting point of the segment to be deleted.

duration
Contains a time value that specifies the duration of the segment to be deleted.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

invalidDuration

-2014

This duration value is invalid

invalidTime

-2015

This time value is invalid

ScaleMovieSegment

The ScaleMovieSegment function changes the duration of a segment of a movie. The Movie Toolbox scales the segment to accommodate the new duration.

pascal OSErr ScaleMovieSegment (Movie theMovie,
                                         TimeValue startTime,
                                         TimeValue oldDuration,
                                         TimeValue newDuration);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

startTime
Specifies the start of the segment. The oldDuration parameter specifies the segment's duration. This time value must be expressed in the movie's time scale.

oldDuration
Specifies the duration of the segment in the source movie. This time value must be expressed in the movie's time scale.

newDuration
Specifies the new duration of the segment. This time value must be expressed in the movie's time scale. The function alters the segment to accommodate the new duration.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

invalidDuration

-2014

This duration value is invalid

invalidTime

-2015

This time value is invalid

Memory Manager errors

CopyMovieSettings

The CopyMovieSettings function copies many settings from one movie to another, overwriting the destination settings in the process.

pascal OSErr CopyMovieSettings (Movie srcMovie, Movie dstMovie);
srcMovie
Specifies the source movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

dstMovie
Specifies the destination movie for this operation. The CopyMovieSettings function uses the settings from the source movie, which is specified by the srcMovie parameter, to replace the current settings of this movie.

DESCRIPTION

The CopyMovieSettings function copies the

If you want to work with specific characteristics, you can use the Movie Toolbox functions that allow you to manipulate movie settings individually. These functions are described in "Functions That Modify Movie Properties," .

This function does not copy the movie's contents. To work with movie contents, you should use the segment editing functions described in "Low-Level Movie-Editing Functions," .

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

Memory Manager errors


© 1999 Apple Computer, Inc.

Previous | Overview | Contents | Next